<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>普通用户-图书管理系统</title>
    <link href="{__STATIC_PATH}layui/css/layui.css" rel="stylesheet"/>
</head>
<body class="layui-layout-body">

<div class="layui-layout layui-layout-admin">

    <div class="layui-header">
        <div class=" layui-nav " style="font-size: x-large; color: #009688;line-height: 60px;"> 图 书 管 理 系 统</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="{__STATIC_PATH}images/user_image.jpg" class="layui-nav-img">
                    <span th:text="${session.admin.getAdminName()}"></span>
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">基本资料</a></dd>
                    <dd><a href="">安全设置</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="/adminLogOut">退出登录</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree">

                <li class="layui-nav-item ">
                    <a class="" href="javascript:;">借阅管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="/user/borrow/record">&emsp;&emsp;借书记录</a></dd>
                        <dd class="layui-this"><a href="/user/borrow/index">&emsp;&emsp;借阅书籍</a></dd>
                    </dl>
                </li>

                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">书籍管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="/user/restore">&emsp;&emsp;归还书籍</a></dd>
                        <dd class="layui-this"><a href="/user/book">&emsp;&emsp;查询书籍</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a href="/user/user">个人信息</a></li>
            </ul>
        </div>
    </div>

    <div class="layui-body layui-container">

        <div class="layui-row">
            <div class="layui-col-md4"><!--左半部分-->

                <hr class="layui-bg-blue">
                <h1 style="text-align:left">查询书籍</h1>
                <hr class="layui-bg-blue">

                <form class="layui-form" action="/user/book" id="findBookByNameForm">

                    <div class="layui-form-item">
                        <input placeholder="请输入书名信息" class="layui-input" autofocus autocomplete="off" type="text"
                               name="bookPartInfo" lay-verify="required">
                    </div>

                    <input class="layui-btn" type="submit" lay-filter="btn1" lay-submit="btn1" value="查询">
                </form>
            </div>


            <div class="layui-col-md7 layui-col-lg-offset1"><!--右半部分-->

                <hr class="layui-bg-blue">
                <h1 style="text-align: left">查询结果</h1>
                <hr class="layui-bg-blue">

                <table class="layui-table ">
                    <thead>
                    <tr>
                        <th>书籍编号</th>
                        <th>书名</th>
                        <th>作者</th>
                        <th>出版社</th>
                        <th>状态</th>
                    </tr>
                    </thead>
                    {volist name="list" id="vo"}
                    <tr>
                        <td>{$vo.book_id}</td>
                        <td>{$vo.book_name}</td>
                        <td>{$vo.book_author}</td>
                        <td>{$vo.book_publish}</td>
                        <td data-id="{$vo.book_id}"><input type="checkbox" {if $vo.book_status == 1}checked{/if} name="status" lay-skin="switch"
                            lay-filter="switchStatus"
                            lay-text="ON|OFF">
                        </td>


                    </tr>
                    {/volist}
                </table>
            </div>
        </div>


    </div>

    <div th:include="common/footer :: footer"></div>

</div>


<script src="{__STATIC_PATH}scripts/jquery.min.js"></script>
<script src="{__STATIC_PATH}layui/layui.js"></script>

<script>
    layui.use(['form', 'element'], function () {
        let form = layui.form;
        let element = layui.element;

        // form.on('submit(btn1)', function (data) {
        //     console.log(data.field, '最终的提交信息')
        //     data = data.field;
        //     let url = '';
        //     // // layObj.post(url,data,function (res) {
        //     // //
        //     // // });
        //     $.ajax({
        //         type: 'POST',
        //         data: data,
        //         url: '/user/book',
        //         success: (res) => {
        //             if (res.status == 0){
        //                 layer.msg(res.message,function (){
        //                     location.reload();
        //                 });
        //             }
        //             setTimeout('window.location.reload()',1000);
        //         }
        //     })
        //
        //     return false;
        // });
    });
</script>

</body>
</html>
